package com.bawei.park


import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
import com.bawei.base.bean.NewsEntity
import com.bawei.base.mvvm.BaseViewModel
import com.bawei.base.net.ApiService

import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

@HiltViewModel
class ParkViewModel @Inject constructor(var apiService: ApiService) : BaseViewModel() {
    fun getNewsList(): Flow<PagingData<NewsEntity>> {
        return Pager( PagingConfig(5), pagingSourceFactory = {
            ParkDataSource(apiService)
        }).flow
    }
}